#include <iostream>
#include <vector>


bool isLeapYear(int year) 
{
    return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}


int main() 
{
    std::ios::sync_with_stdio(false);
    std::cout.tie(0);

    std::vector<int>res;
    int x,y;
    std::cin>>x>>y;
    int s = (x/4)*4+4;
    
    int count = 0;

    
    // 单独处理第一年
    if (isLeapYear(s))
    {
        res.push_back(s);
        count++;
    }

    for (int i =s ;i <=y;i+=4)
    {
        if (res[0] == i)
        {
            continue;
        }
        if (isLeapYear(i))
        {
            res.push_back(i);
            count++;
        }
    }

    std::cout<<count<<std::endl;
    for (auto i:res)
    {
        std::cout<<i<<" ";
    }
    return 0;
}